<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>graph</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/python-graph/">python-graph</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;graph
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
      </table>
    </td>
  </tr>
</table>
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package graph</h1><p class="nomargin-top"></p>
<p>python-graph</p>
  <p>A library for working with graphs in Python.</p>

<hr />
<div class="fields">      <p><strong>Version:</strong>
        1.4.2
        <p>Data structure classes are exposed at the top-level:</p>
        <ul>
          <li>
            The <a href="graph.classes.Graph.graph-class.html" 
            class="link">graph</a> class is exposed as 
            <code>graph.graph()</code>.
          </li>
          <li>
            The <a href="graph.classes.Digraph.digraph-class.html" 
            class="link">digraph</a> class is exposed as 
            <code>graph.digraph()</code>.
          </li>
          <li>
            The <a href="graph.classes.Hypergraph.hypergraph-class.html" 
            class="link">hypergraph</a> class is exposed as 
            <code>graph.hypergraph()</code>.
          </li>
        </ul>
        <p>Helper classes are exposed one level beneath:</p>
        <ul>
          <li>
            <a href="graph.algorithms.filters-module.html" 
            class="link">Search filters</a> are exposed in 
            <code>graph.filters</code>.
          </li>
          <li>
            <a href="graph.algorithms.heuristics-module.html" 
            class="link">Heuristics</a> for the A* algorithm are exposed in
            <code>graph.heuristics</code>.
          </li>
        </ul>
        <p>A quick introductory example:</p>
<pre class="py-doctest">
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Import the module and instantiate a graph object</span>
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">import</span> graph
<span class="py-prompt">&gt;&gt;&gt; </span>gr = graph.graph()
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Add nodes</span>
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_nodes([<span class="py-string">'X'</span>,<span class="py-string">'Y'</span>,<span class="py-string">'Z'</span>])
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_nodes([<span class="py-string">'A'</span>,<span class="py-string">'B'</span>,<span class="py-string">'C'</span>])
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Add edges</span>
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_edge(<span class="py-string">'X'</span>,<span class="py-string">'Y'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_edge(<span class="py-string">'X'</span>,<span class="py-string">'Z'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_edge(<span class="py-string">'A'</span>,<span class="py-string">'B'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_edge(<span class="py-string">'A'</span>,<span class="py-string">'C'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span>gr.add_edge(<span class="py-string">'Y'</span>,<span class="py-string">'B'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Depth first search rooted on node X</span>
<span class="py-prompt">&gt;&gt;&gt; </span>st, pre, post = gr.depth_first_search(root=<span class="py-string">'X'</span>)
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-comment"># Print the spanning tree</span>
<span class="py-prompt">&gt;&gt;&gt; </span><span class="py-keyword">print</span> st
<span class="py-output">{'A': 'B', 'C': 'A', 'B': 'Y', 'Y': 'X', 'X': None, 'Z': 'X'}</span></pre>
      </p>
</div><!-- ==================== SUBMODULES ==================== -->
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td align="left" colspan="2" class="table-header">
    <span class="table-header">Submodules</span></td>
</tr>
  <tr><td class="summary">
  <ul class="nomargin">
    <li> <strong class="uidlink"><a href="graph.algorithms-module.html">graph.algorithms</a></strong>: <em class="summary">Algorithms</em>
    <ul>
    <li> <strong class="uidlink"><a href="graph.algorithms.accessibility-module.html">graph.algorithms.accessibility</a></strong>: <em class="summary">Accessibility algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.cycles-module.html">graph.algorithms.cycles</a></strong>: <em class="summary">Cycle detection algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.exceptions-module.html">graph.algorithms.exceptions</a></strong>: <em class="summary">Exceptions.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.filters-module.html">graph.algorithms.filters</a></strong>: <em class="summary">Set of searching filters.</em>
    <ul>
    <li> <strong class="uidlink"><a href="graph.algorithms.filters.Find-module.html">graph.algorithms.filters.Find</a></strong>: <em class="summary">Search filter for finding a specific node.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.filters.Null-module.html">graph.algorithms.filters.Null</a></strong>: <em class="summary">Null searching filter.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.filters.Radius-module.html">graph.algorithms.filters.Radius</a></strong>: <em class="summary">Radial search filter.</em>    </li>
    </ul>
    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.generators-module.html">graph.algorithms.generators</a></strong>: <em class="summary">Random graph generators.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.heuristics-module.html">graph.algorithms.heuristics</a></strong>: <em class="summary">Set of search heuristics.</em>
    <ul>
    <li> <strong class="uidlink"><a href="graph.algorithms.heuristics.Chow-module.html">graph.algorithms.heuristics.Chow</a></strong>: <em class="summary">Edmond Chow's heuristic for A*.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.heuristics.Euclidean-module.html">graph.algorithms.heuristics.Euclidean</a></strong>: <em class="summary">A* heuristic for euclidean graphs.</em>    </li>
    </ul>
    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.minmax-module.html">graph.algorithms.minmax</a></strong>: <em class="summary">Minimization and maximization algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.readwrite-module.html">graph.algorithms.readwrite</a></strong>: <em class="summary">Functions for reading and writing graphs.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.searching-module.html">graph.algorithms.searching</a></strong>: <em class="summary">Search algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.sorting-module.html">graph.algorithms.sorting</a></strong>: <em class="summary">Sorting algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.traversal-module.html">graph.algorithms.traversal</a></strong>: <em class="summary">Traversal algorithms.</em>    </li>
    <li> <strong class="uidlink"><a href="graph.algorithms.utils-module.html">graph.algorithms.utils</a></strong>: <em class="summary">Miscellaneous useful stuff.</em>    </li>
    </ul>
    </li>
    <li> <strong class="uidlink"><a href="graph.classes-module.html">graph.classes</a></strong>: <em class="summary">Data structure classes.</em>
    <ul>
    <li> <strong class="uidlink"><a href="graph.classes.Digraph-module.html">graph.classes.Digraph</a></strong>: <em class="summary">Digraph class</em>    </li>
    <li> <strong class="uidlink"><a href="graph.classes.Graph-module.html">graph.classes.Graph</a></strong>: <em class="summary">Graph class</em>    </li>
    <li> <strong class="uidlink"><a href="graph.classes.Hypergraph-module.html">graph.classes.Hypergraph</a></strong>: <em class="summary">Hypergraph class</em>    </li>
    </ul>
    </li>
  </ul></td></tr>
</table>

<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/python-graph/">python-graph</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sun Feb 22 18:11:02 2009
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
